import { VRTree, VRList } from "@/views/VR/test2.js"
import { getVRtree, getSceneList } from "@/api/VR"
const state = {
    VRTree: VRTree,
    VRList: VRList,
    isRealTest: false, //是否医院本地测试用 
    //test3是 纯列表测试
    //test33是 最新cq7真实结构测试
    //testJSON_7 是 最新cq7真实结构测试(用于历史存储)
    //testJSON 是 最新cq7真实结构测试(使用)
}
const mutations = {
    SET_VRTREE: (state, VRTree) => {
      state.VRTree = VRTree
    },
    SET_VRLIST: (state, VRList) => {
      state.VRList = VRList
    },
}

const actions = {
    // 获取VR树形结构数据
    handleGetVRtree(context, params) {
        return new Promise((resolve, reject) => {
            getVRtree(params).then(res => {
              if(res.code){
                console.log('res.data.list11',res.data);
                context.commit('SET_VRTREE',res.data)
                resolve(res)
              }else reject('error')
            })
        })
    },
    // 获取VR场景图列表
    handleGetVRList(context, params) {
        return new Promise((resolve, reject) => {
          getSceneList(params).then(res => {
              if (res.code){
                context.commit('SET_VRLIST',res.data.list)
                resolve(res)
              }else reject('error')
            })
        })
    }
}

export default {
    namespaced: true, //命名空间
    state,
    mutations,
    actions,
}
